package dsg.graphdb.www.web;

import dsg.graphdb.www.entity.AjaxResult;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhiwei
 * @date 2023/3/26 - 9:35
 */
@RestController
public class TotalController {


    @PostMapping("/search")
    public AjaxResult searchResult(@RequestBody Map<String, Object> data) {

        System.out.println("search--"+data.get("text"));
        String param = data.get("text").toString();
//        List<AbstractEntity> nodes = searchRepository.seachNodes(param);
//        System.out.println("nodes--"+nodes);
//        List<AbstractRelation> relations = searchRepository.seachRelations(param);
        Map<String, List> map = new HashMap<>();
//        map.put("node", nodes);
//        map.put("relation", relations);
        return AjaxResult.success(map);
    }

    @GetMapping("/all/test")
    public AjaxResult gey() {
//        List<String> all = checkrepository.allNodeRelation();
//        System.out.println("---"+all.toString());
//        List<RelationShip> all = relationShipRepository.all();
//        List<RelationExam> all1 = relationShipRepository.all1();
//        List<RelationConfirm> all2 = relationShipRepository.all2();

        List<Object> list = new ArrayList<>();
//        list.addAll(all);
//        list.addAll(all1);
//        list.add(all2);

        return AjaxResult.success(list);
    }
}

